package com.xiejr.pss.tuning;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * 测试当系统oom的时候， 打印系统内存快照信息
 *
 * @author mobai
 * @since 2021/8/12 00:01
 */
public class OOMTest {

    //-Xms10m -Xmx10m -XX:+PrintGCDetails -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/Users/mobai/Desktop/projects/programmers-self-salvation/jvm/Performance-Tuning/jvm.dump

    public static void main(String[] args) {
        ExecutorService executorService = Executors.newFixedThreadPool(1);
        while (true){
            executorService.execute(()->{
                try {
                    Thread.sleep(1000000L);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println("hello");
            });
        }

    }
}
